﻿using Kavaa.Modules.PortailMedical.Datalayer;
using Kavaa.Modules.PortailMedical.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kavaa.Modules.PortailMedical.Repository
{
    public static class Clinique
    {
       
        public static Reservations GetReservCliniqueEnCours(int IdClinique)
        {
            Reservations Reservations = ReservationDAO.GetReservClinique(IdClinique);
            Reservations ReservationsEncours = new Reservations();
            foreach (Reservation Reserv in Reservations)
            {
                if (Reserv.etat == 0 && Reserv.DateDebut>DateTime.Now)
                {
                    ReservationsEncours.Add(Reserv);

                }
            }
            return ReservationsEncours;


        }
        public static Reservations GetReservCliniqueAccordees(int IdClinique)
        {
            Reservations Reservations = ReservationDAO.GetReservClinique(IdClinique);
            Reservations ReservationsAccordees = new Reservations();
            foreach (Reservation Reserv in Reservations)
            {
                if (Reserv.etat == 1)
                {
                    ReservationsAccordees.Add(Reserv);

                }
            }
            return ReservationsAccordees;



        }
        public static String GetBlocReserv(int IdReserv)
        {
            return ReservationDAO.GetBlocReserv(IdReserv);
        }
        public static void ConfirmReserv(int reservId)
        {
            ReservationDAO.ConfirmReserv(reservId);
        }
        public static void RejectReserv(int reservId)
        {
            ReservationDAO.RejectReserv(reservId);
        }
        public static Accreditations GetAccreditationsAttente(int cliniqueId)
        {
            return AccreditationDAO.GetAccreditationsAttente(cliniqueId);
        }
        public static void UpdateEtatAccredit(int etat, int id)
        {
            AccreditationDAO.UpdateEtatAccredit(etat, id);

        }
        public static int SaveRessourceClinique(int RessourceId, int CliniqueId)
        {
           return  CliniqueDAO.SaveRessourceClinique(RessourceId, CliniqueId);
        }
        public static void SavePropriete(int CategorieId, String ProprieteName, String ProprieteValue)
        {
             ProprieteDAO.SavePropriete(CategorieId, ProprieteName, ProprieteValue);
        }
        public static void SaveActesCategorie(int ActeId, int CategorieId)
        {
            CategorieDAO.SaveActesCategorie(ActeId, CategorieId);
        }
        public static int SaveCategorie(String Categorie, int RessourceCliniqueId)
        {
            return CategorieDAO.SaveCategorie(Categorie, RessourceCliniqueId);
        }
        public static Categories GetRessourcesClinique(int CliniqueId)
        {
            return CategorieDAO.GetRessourcesClinique(CliniqueId);
        }
        public static Reservations GetReservationPatient(int ReservId)
        {
            return ReservationDAO.GetReservationPatient(ReservId);
        }
        public static void SaveActeClinique(int[] ActesId, int CliniqueId)
        {
            foreach (int acteId in ActesId)
            {
                ActeDAO.SaveActeClinique(acteId, CliniqueId);
            }
        }
        
    }
}
